<?php
if (isset($_SESSION['openid']) && isset($_POST['id']) ){
    include '../c/config.php';
    $mysqli = new mysqli($dbhost, $dbuser, $dbpwd, $dbName);
    if (!$mysqli->set_charset("utf8")) {printf("Error loading character set utf8: %s\n", $mysqliTwo->error);}
    $openid=$_SESSION['openid'];
    $cday=date("md");
    $query=$mysqli->query("select count(id) as count from chou where openid='".$openid."' and cday='".$cday."' limit 0,3 ");
    $getData=$query->fetch_array();
    $count=3 - $getData['count'];
    echo json_encode(array('n'=>$count));
}else{
    echo json_encode(array('n'=>0));
}